using System;
using System.Collections.Generic;
using System.Text;

namespace Tortuga.Core.TortoiseCommands {
	/// <summary>
	/// Brings up the Tortoise checkout dialog window.
	/// </summary>
	public class CheckoutCommand : SinglePathTortoiseCommand {
		private string _url = "";

		private CheckoutCommand() : this("checkout", "") { }

		private CheckoutCommand(string path)
			: base("checkout", path) {
			this.OptionsToBuild = new List<BuildOptionDelegate>(new BuildOptionDelegate[] {
				this.BuildPathOption,
				this.BuildUrlOption,
				this.BuildNoTempFile,
				this.BuildCloseOnEnd
			});
		}

		/// <summary>
		/// Instantiates a checkout command with the passed path and url.
		/// </summary>
		/// <param name="path"></param>
		/// <param name="url"></param>
		public CheckoutCommand(string path, string url)
			: this(path) {
			this.Url = url;
		}

		/// <summary>
		/// Builds the Url option.
		/// </summary>
		/// <returns>/url:"Url"</returns>
		public string BuildUrlOption() {
			return BuildUrlOption(Url);
		}

		/// <summary>
		/// Gets or sets the Url from where the checkout should be performed.
		/// </summary>
		public string Url {
			get { return _url; }
			set { _url = value; }
		}
		
	}
}
